package com.wlc.rabbitmq.topicqueue;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @author 王立朝
 * @description 主题消费者
 * @date 2021-12-15 10:09:39
 */
@Component
public class TopicConsumer {

    @RabbitListener(queues = "topic_queue_1")
    public void readMessage(Message message, Channel channel) throws IOException {
        channel.basicAck(message.getMessageProperties().getDeliveryTag(), true);
        System.out.println("我是消费信息111：" + new String(message.getBody()));
    }

}
